from django.conf.urls import patterns, url

from piston.resource import Resource
from piston.authentication import HttpBasicAuthentication
from piston.doc import documentation_view

from anvil.handlers import *

auth = HttpBasicAuthentication(realm='My sample API')

assets = Resource(handler=AssetHandler, authentication=None)
worlds = Resource(handler=WorldHandler, authentication=None)
objects = Resource(handler=ObjectHandler, authentication=None)
modifiers = Resource(handler=ModifierHandler, authentication=None)


urlpatterns = patterns('',   

    url(r'^assets/$', assets),
    url(r'^assets/(?P<id>.+?)/?$', assets, name='assets'), 
    
    url(r'^worlds/$', worlds),
    url(r'^worlds/(?P<id>.+?)/?$', worlds, name='worlds'),   
    
    url(r'^objects/$', objects),
    url(r'^objects/(?P<id>.+?)/?$', objects, name='objects'), 
    
    url(r'^modifiers/$', modifiers),
    url(r'^modifiers/(?P<id>.+?)/?$', modifiers, name='modifiers'),
    

    # automated documentation
    url(r'^$', documentation_view),
)
